package com.lonely.fx;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.MenuItem;
import javafx.scene.control.SplitMenuButton;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;

/**
 * @date: 2022-07-07 15:16
 * @author: ztkj-hzb
 * @description: 用法和MenuButton一样，只是展示样式不一样
 **/
public class SplitMenuButtonSettingMain extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    /**
     *
     */
    @Override
    public void start(Stage primaryStage) throws Exception {

        HBox hBox = new HBox();

        //TODO 用法和MenuButton一样，只是展示样式不一样
        SplitMenuButton splitMenuButton = new SplitMenuButton();
        splitMenuButton.setText("球类");

        MenuItem menuItem1 = new MenuItem("篮球");
        MenuItem menuItem2 = new MenuItem("足球");
        MenuItem menuItem3 = new MenuItem("羽毛球");

        splitMenuButton.getItems().addAll(menuItem1,menuItem2,menuItem3);

        hBox.getChildren().add(splitMenuButton);

        primaryStage.setScene(new Scene(hBox));
        primaryStage.setWidth(600);
        primaryStage.setHeight(500);
        primaryStage.show();

    }
}
